//
//  ZXHomeViewController.m
//  ZiJinLian
//
//  Created by 震霄 张 on 2018/3/9.
//  Copyright © 2018年 lzy. All rights reserved.
//

#import "ZXHomeViewController.h"
#import "ShopsCollectionViewCell.h"
#import "ZXHomeSectionView.h"
#import "HomeZXAllModel.h"
#import "HomeSuggestModel.h"
#import "ZXHomeHeadView.h"
//
#import "ZJTipsBtn.h"
#import "ZJMeHeadView.h"
#import "ShopsCollectionViewCell.h"
#import "CollectionViewHeaderView.h"
#import "FirstHeadCollectionReusableView.h"
#import "SecondHeadCollectionReusableView.h"
#import "SupplicationViewController.h"
#import "ApplyViewController.h"
#import "EnterViewController.h"
#import "TempleViewController.h"
#import "ShopListsViewController.h"
#import "MessageViewController.h"
#import "CityViewController.h"
#import "homeModel.h"
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
#import "ZJBaseNavControllerViewController.h"
#import "LogisViewController.h"
#import "LoadMaskHelper.h"
#import "MyWishViewController.h"
//商品详情
//H5页面

//测试跳转的控制器
#import "ShopDetailViewController.h"
#import "ShopListsViewController.h"
#import "MyOrderViewController.h"
#import "MyOrderListViewController.h"
//
@interface ZXHomeViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,CLLocationManagerDelegate>
@property (nonatomic, strong) UICollectionView  *collectionView;
@property (nonatomic,weak)UICollectionReusableView *FirstHeaderView;
@property (nonatomic,strong)HomeZXAllModel *dataModel;

@property (nonatomic, strong) UIImageView*msgImg;
@property (nonatomic, strong) CLLocationManager * locationManager;
@property (nonatomic, strong) MYLabel * HeadLabel;
@property (nonatomic, strong) UILabel * leftlabel;
@property (nonatomic, strong) NSArray *firstArray;
@property (nonatomic, strong) NSArray *groupArray;
@property (nonatomic, strong) NSArray *firstAdArray;
@property (nonatomic, strong) NSArray *secondArray;
@property (nonatomic, strong) NSArray *itemsArray;
@property (nonatomic, strong) UIButton * sectionBtn;
@property (strong, nonatomic) UIButton     * topBtn;
@property (nonatomic,strong)  homeModel*headModel;

@end

@implementation ZXHomeViewController

static NSString * const reuseIdentifierHeader = @"FirstHeadCollectionReusableView";

static NSString * const reuseIdentifierOtherHeader = @"OtherHeadCollectionReusableView";

-(void)viewWillAppear:(BOOL)animated{
	[super viewWillAppear:YES];
	_isLogin=[ZJUserDefaultsTools isLogin];
	self.navigationController.navigationBar.hidden=NO;
	
	[self setupUnreadMessageCount];
	//[self checkVersionRequest];
	
}

- (void)viewDidLoad {
    [super viewDidLoad];
	self.view.backgroundColor = [UIColor whiteColor];
	[self createUI];
	[self loadMainData];
	[self startLocation];
	[self creatNavUI];
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(InfoNotificationAction) name:@"unReadInfo" object:nil];
	//避免数据已经存在
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(maskView:) name:@"InfoNotification" object:nil];
	//其他设备登录通知
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitAccount) name:@"lginOther" object:nil];
	//页面跳转
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(makeJUMP:) name:@"jumpOther" object:nil];
	
	
	
}
-(void)makeJUMP:(NSNotification *)info
{
//	NSDictionary *dic=@{@"info":@"shadown"};
//	NSNotification *notification =[NSNotification notificationWithName:@"InfoNotification" object:nil userInfo:dic];
//	// 3.通过 通知中心 发送 通知
//	[[NSNotificationCenter defaultCenter] postNotification:notification];
	NSLog(@"%@",info.userInfo);

	NSInteger jumpType = [[info.userInfo valueForKey:@"type"]integerValue];
	if ( jumpType == 1) {//广告
		WelcomViewController *vc=[[WelcomViewController alloc]init];
		vc.reLastURL=[info.userInfo valueForKey:@"value"];
		[self.navigationController pushViewController:vc animated:YES];
	}else if (jumpType == 2){//商品详情
		ShopDetailViewController *vc=[[ShopDetailViewController alloc]init];
		vc.spuId=[info.userInfo valueForKey:@"value"];
		[self.navigationController pushViewController:vc animated:YES];
		
	}else if (jumpType == 3){//跳转分类
		ShopListsViewController *vc=[[ShopListsViewController alloc]init];
		vc.ids=[info.userInfo valueForKey:@"value"];
		vc.origin=1;
		[self.navigationController pushViewController:vc animated:YES];
		
	}else if (jumpType == 4){//跳转到更多
		ShopListsViewController *vc=[[ShopListsViewController alloc]init];
		vc.ids=[info.userInfo valueForKey:@"value"];
		vc.origin=3;
		[self.navigationController pushViewController:vc animated:YES];
	}else if (jumpType == 5){
		
		NSString *ID = [info.userInfo valueForKey:@"value"];
		[self jumpToGoodsClassfyWithID:ID];
	}
	
}

-(void)jumpToGoodsClassfyWithID:(NSString *)ID
{
	NSMutableDictionary*dic=[NSMutableDictionary dictionary];
	[dic setValue:ID forKey:@"conditionId"];
	[dic setValue:@"20" forKey:@"pageSize"];
	[dic setValue:@"1" forKey:@"pageNumber"];
	
	[self doHttpRequestWithApi:API_HOMESHOP_REQUEST_CLASSFY method:POST dic:dic successBlock:^(NSDictionary *dic) {
		NSLog(@"%@",dic);
		if ([dic[@"status"]integerValue] == 0) {
			ShopListsViewController *vc=[[ShopListsViewController alloc]init];
			vc.requestDic = dic;
//			vc.ids=[info.userInfo valueForKey:@"value"];
			vc.origin=4;
			[self.navigationController pushViewController:vc animated:YES];
		}
	}];
}

-(void)createUI
{
//	[self.view addSubview:self.collectionView];
	//祈愿入口
	UIButton *requestBtn = [UIButton buttonWithType:UIButtonTypeCustom];
	[requestBtn setBackgroundImage:[UIImage imageNamed:@"icon_wish-1"] forState:UIControlStateNormal];
	[requestBtn addTarget:self action:@selector(requestBtnCLick) forControlEvents:UIControlEventTouchUpInside];
	requestBtn.width = 35;
	requestBtn.height = 35;
	requestBtn.y = screen_Height - 64 - 80-44;
	requestBtn.x = screen_Width - 35 - 35;
	[self.view addSubview:requestBtn];
//	requestBtn.sd_layout.widthIs(35).heightIs(35).bottomSpaceToView(self.view, 80).rightSpaceToView(self.view, 25);
	
	[self.view insertSubview:self.collectionView aboveSubview:requestBtn];
	[self.view bringSubviewToFront:requestBtn];
}
-(void)requestBtnCLick
{
	if ([ZJUserDefaultsTools isLogin]) {
		SupplicationViewController*vc=[[SupplicationViewController alloc]init];
		[self.navigationController pushViewController:vc animated:YES];
	}else{
		ZJLoginViewController *controller = [[ZJLoginViewController alloc] init];
		ZJBaseNavControllerViewController* nav=[[ZJBaseNavControllerViewController alloc]initWithRootViewController:controller];
		controller.modality=NO;
		[self presentViewController:nav animated:YES completion:nil];
	}
}
-(void)loadMainData{
	self.isShowDiag=NO;
	NSMutableDictionary*dic=[NSMutableDictionary dictionary];
	[self doHttpRequestWithApi:API_HOMESHOP_LIST method:GET dic:dic successBlock:^(NSDictionary *dic) {
		NSLog(@"%@",dic);
		if ([dic[@"status"]integerValue] == 0) {
			self.dataModel = [HomeZXAllModel mj_objectWithKeyValues:dic[@"data"]];
			[self.collectionView reloadData];
		}
	}];
}
- (UICollectionView *)collectionView
{
	if (!_collectionView)
	{
		UICollectionViewFlowLayout *flowlayout = [[UICollectionViewFlowLayout alloc] init];
		//设置滚动方向
		[flowlayout setScrollDirection:UICollectionViewScrollDirectionVertical];
		//左右间距
		flowlayout.minimumInteritemSpacing =5;
		//上下间距
		flowlayout.minimumLineSpacing =5 ;
//		CGFloat photoSize = (self.view.frame.size.width - 45) / 2;
//		flowlayout.minimumInteritemSpacing = 10.0;//item 之间的行的距离
//		flowlayout.minimumLineSpacing = 10.0;//item 之间竖的距离
//		flowlayout.itemSize = (CGSize){photoSize,photoSize/110 * 80};
//		flowlayout.sectionInset = UIEdgeInsetsMake(0, 0, 10, 10);
		
		_collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH-64-49) collectionViewLayout:flowlayout];
		_collectionView.backgroundColor = Gray_Color;
		_collectionView.delegate = self;
		_collectionView.dataSource = self;
		_collectionView.showsVerticalScrollIndicator = NO;
		_collectionView.showsHorizontalScrollIndicator = NO;
		//注册cell
		[_collectionView registerNib:[UINib nibWithNibName:@"ShopsCollectionViewCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"ShopsCell"];
		//注册分区头标题
//		[_collectionView registerClass:[ZXHomeSectionView class]
//			forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
//				   withReuseIdentifier:@"FirstHeadCollectionReusableView"];
		[_collectionView registerNib:[UINib nibWithNibName:NSStringFromClass([ZXHomeSectionView class]) bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseIdentifierHeader];
		
			[_collectionView registerNib:[UINib nibWithNibName:NSStringFromClass([ZXHomeHeadView class]) bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseIdentifierOtherHeader];
		
//		[_collectionView registerClass:[SecondHeadCollectionReusableView class]
//			forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
//				   withReuseIdentifier:@"SecondHeadCollectionReusableView"];
		_collectionView.mj_header=[MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(topLoadRefresh)];
	}
	return _collectionView;
}
-(void)topLoadRefresh{
	[self loadMainData];
	//NSLog(@"刷新");
	[_collectionView.mj_header endRefreshing];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableView DataSource Delegate



- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
	return self.dataModel.indexModuleCate.data.count;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{

	if (self.dataModel.indexModuleCate.data.count>section) {
		HomeSuggestModel *sm = self.dataModel.indexModuleCate.data[section];
		return sm.skus.count;
	}else{
		return 0;
	}
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
	
	ShopsCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ShopsCell" forIndexPath:indexPath];
	HomeSuggestModel *sm = self.dataModel.indexModuleCate.data[indexPath.section];
	cell.model = sm.skus[indexPath.row];
	
	return cell;
}
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
	CGFloat height=[ZJUITools getHeightByWidth:self.view.frame.size.width-20 title:@"释迦摩尼佛像(文殊菩萨)" font:FontAndStyle14] + (MainW-15)/2+35;
	return CGSizeMake((MainW-5)/2, height);
}
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
	return UIEdgeInsetsMake(5, 0, 5, 0);//分别为上、左、下、右
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
	if (section==0) {
		return CGSizeMake(MainW,[self.dataModel getFirstSecHeight]);
	}else{
		return CGSizeMake(MainW,100+(MainW-50)*0.4);
	}

}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
	HomeSuggestModel *model = self.dataModel.indexModuleCate.data[indexPath.section];
	HomeGoodInfoModel *goodModel = model.skus[indexPath.row];
	ShopDetailViewController *vc=[[ShopDetailViewController alloc]init];
	vc.spuId=[NSString stringWithFormat:@"%ld",goodModel.skuId];
	[self.navigationController pushViewController:vc animated:YES];
	////NSLog(@"商品ID----------%@级",arry[indexPath.row][@"spuId"]);
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
	UICollectionReusableView *supplementaryView;
	
	if ([kind isEqualToString:UICollectionElementKindSectionHeader]){
		
		if (indexPath.section == 0) {
			ZXHomeSectionView *headview = (ZXHomeSectionView *)[collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseIdentifierHeader forIndexPath:indexPath];
			headview.model = self.dataModel;
			supplementaryView = headview;
		}else{
			ZXHomeHeadView *headV = (ZXHomeHeadView *)[collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reuseIdentifierOtherHeader forIndexPath:indexPath];
			headV.model = self.dataModel.indexModuleCate.data[indexPath.section];
			supplementaryView = headV;
		}

		
	}
	else if ([kind isEqualToString:UICollectionElementKindSectionFooter]){
		

		
		supplementaryView = [UIView new];
		
	}
	
	return supplementaryView;

}

-(void)setupUnreadMessageCount
{
	NSArray *conversations = [[EMClient sharedClient].chatManager getAllConversations];
	NSInteger unreadCount = 0;
	for (EMConversation *conversation in conversations) {
		unreadCount += conversation.unreadMessagesCount;
	}
	NSLog(@"未读消息%ld",(long)unreadCount);
	if (unreadCount==0) {
		self.msgImg.image=[UIImage imageNamed:@"icon_message_nor"];
	}else{
		//2017.6.28修改
		self.msgImg.image=[UIImage imageNamed:@"icon_message_reminder"];
	}
	
}
-(void)checkVersionRequest{
	NSMutableDictionary*dic=[NSMutableDictionary dictionary];
	[self doHttpRequestWithApi:CHECKVERSION method:GET dic:dic successBlock:^(NSDictionary *dic) {
		NSLog(@"----%@",dic[@"content"]);
	}];
}
//定位
-(void)startLocation
{
	if([CLLocationManager locationServicesEnabled])
	{
		// 启动位置更新
		// 开启位置更新需要与服务器进行轮询所以会比较耗电，在不需要时用stopUpdatingLocation方法关闭;
		_locationManager = [[CLLocationManager alloc] init];
		//设置定位的精度
		[_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
		_locationManager.distanceFilter = 10.0f;
		_locationManager.delegate = self;
		if ([[[UIDevice currentDevice] systemVersion] floatValue] > 8.0)
		{
			[_locationManager requestAlwaysAuthorization];
			[_locationManager requestWhenInUseAuthorization];
		}
		
		//开始实时定位
		[_locationManager startUpdatingLocation];
	}else {
		//NSLog(@"请开启定位功能！");
	}
}
//代理,定位代理经纬度回调
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
{
	CLLocation * newLoaction = locations[0];
	CLLocationCoordinate2D oCoordinate = newLoaction.coordinate;
	NSLog(@"旧的经度：%f，旧的维度：%f",oCoordinate.longitude,oCoordinate.latitude);
	
	[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%f",oCoordinate.longitude] forKey:@"longitude"];
	[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%f",oCoordinate.latitude] forKey:@"latitude"];
	[[NSUserDefaults standardUserDefaults] synchronize];
	[self.locationManager stopUpdatingLocation];
	//创建地理位置解码编码器对象
	CLGeocoder * geoCoder = [[CLGeocoder alloc] init];
	[geoCoder reverseGeocodeLocation:newLoaction completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
		
		for (CLPlacemark * place in placemarks) {
			//            NSDictionary * location = [place addressDictionary];
			//            //NSLog(@"国家：%@",[location objectForKey:@"Country"]);
			//            //NSLog(@"城市：%@",[location objectForKey:@"State"]);
			//            //NSLog(@"区：%@",[location objectForKey:@"SubLocality"]);
			
			//NSLog(@"位置：%@",place.name);
			self.leftlabel.text = place.locality;
			//                        //NSLog(@"国家：%@",place.country);
			//                        //NSLog(@"城市：%@",place.locality);
			//                        //NSLog(@"区：%@",place.subLocality);
			//                        //NSLog(@"街道：%@",place.thoroughfare);
			//                        //NSLog(@"子街道：%@",place.subThoroughfare);
		}
	}];
}
-(void)loadAddressData{
	[self doHttpRequestWithApi:@"/api/common/area" method:GET dic:nil successBlock:^(NSDictionary *dic) {
		NSLog(@"地址数据源:%@",dic);
	}];
}
#pragma mark ------创建导航内容
-(void)showMessageClick{
	if (_isLogin) {
		EaseConversationListViewController *chatController = [[EaseConversationListViewController alloc]init];
		chatController.title=MyString(@"消息");
		[self.navigationController pushViewController:chatController animated:YES];
	}else{
		ZJLoginViewController *controller = [[ZJLoginViewController alloc] init];
		ZJBaseNavControllerViewController* nav=[[ZJBaseNavControllerViewController alloc]initWithRootViewController:controller];
		controller.modality=NO;
		[self presentViewController:nav animated:YES completion:nil];
	}
	
	//NSLog(@"消息");
}
-(void)showaddressClick{
	
	//    CityViewController *controller = [[CityViewController alloc] init];
	//    controller.currentCityString = self.leftlabel.text;
	//    controller.selectString = ^(NSString *string){
	//        self.leftlabel.text = string;
	//    };
	//    [self presentViewController:controller animated:YES completion:nil];
	//NSLog(@"地址");
}
#pragma mark ------创建搜索按钮
-(void)searchClick{
	ShopListsViewController*vc=[[ShopListsViewController alloc]init];
	vc.origin=2;
	[self.navigationController pushViewController:vc animated:YES];
	//NSLog(@"搜索");
}
-(void)creatNavUI{
	UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 44)];
	self.msgImg=[[UIImageView alloc]initWithFrame:CGRectMake(24, 6, 16, 16)];
	self.msgImg.image=[UIImage imageNamed:@"icon_message_nor"];
	[testView addSubview:self.msgImg];
	UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(4, 24, 40, 15)];
	label.text=MyString(@"消息");
	label.textColor=[UIColor whiteColor];
	label.font=FontAndStyle12;
	label.textAlignment=2;
	[testView addSubview:label];
	UIButton *buttn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 44)];
	[buttn addTarget:self action:@selector(showMessageClick) forControlEvents:UIControlEventTouchUpInside];
	[testView addSubview:buttn];
	self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:testView];
	
	UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 44)];
	self.leftlabel=[[UILabel alloc]initWithFrame:CGRectMake(-5, 24, 40, 15)];
	self.leftlabel.text=MyString(@"南通");
	self.leftlabel.textColor=[UIColor whiteColor];
	self.leftlabel.font=FontAndStyle12;
	self.leftlabel.textAlignment=1;
	[leftView addSubview:self.leftlabel];
	UIImageView*leftImg=[[UIImageView alloc]initWithFrame:CGRectMake(self.leftlabel.bsg_centerX-6, 6, 12, 16)];
	leftImg.image=[UIImage imageNamed:@"icon_location"];
	[leftView addSubview:leftImg];
	UIButton *leftbuttn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 44)];
	[leftbuttn addTarget:self action:@selector(showaddressClick) forControlEvents:UIControlEventTouchUpInside];
	[leftView addSubview:leftbuttn];
	self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftView];
	UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, MainW-120, 30)];//allocate titleView
	//UIColor *color =  self.navigationController.navigationBar.tintColor;
	[titleView setBackgroundColor:[UIColor clearColor]];
	UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, MainW-120, 30)];
	[btn addTarget:self action:@selector(searchClick) forControlEvents:UIControlEventTouchUpInside];
	[titleView addSubview:[ZJUITools customSearchbar]];
	[titleView addSubview:btn];
	//Set to titleView
	self.navigationItem.titleView = titleView;
	self.topBtn=[[UIButton alloc]init];
	self.topBtn.frame= CGRectMake(MainW-50, MainH-64-100, 40, 40);
	self.topBtn.hidden=YES;
	[self.topBtn setBackgroundImage:[UIImage imageNamed:@"icon_top"] forState:UIControlStateNormal];
	[self.topBtn addTarget:self action:@selector(backTopClick) forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:self.topBtn];
	[self.topBtn bringSubviewToFront:self.collectionView];
	
}
-(void)backTopClick{
	[self.collectionView setContentOffset:CGPointMake(0, 0) animated:YES];
}

-(void)InfoNotificationAction{
	self.msgImg.image=[UIImage imageNamed:@"icon_message_reminder"];
	//NSLog(@"消息啊啊啊啊");
}
#pragma mark 退出账户
-(void)exitAccount{
	UIAlertView* alter =[[UIAlertView alloc]initWithTitle:MyString(@"该账户已在别的设备登录,请重新登录!") message:nil delegate:self cancelButtonTitle:MyString(@"确定") otherButtonTitles:MyString(@"取消"), nil];
	[alter show];
	
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
	[alertView dismissWithClickedButtonIndex:buttonIndex animated:YES];
	if (buttonIndex==0) {
		EMError *error = [[EMClient sharedClient] logout:YES];
		if (!error) {
			NSLog(@"退出成功");
		}
		[ZJUserDefaultsTools clearWithoutAvatar];
		
		ZJLoginViewController *controller = [[ZJLoginViewController alloc] init];
		
		ZJBaseNavControllerViewController*
		nav=[[ZJBaseNavControllerViewController alloc]initWithRootViewController:controller];
		//controller.modality=NO;
		[self presentViewController:nav animated:YES completion:nil];
	}
}
-(void)maskView:(NSNotification *)info{
	if (self.groupArray.count!=0&&self.groupArray!=nil&&[info.userInfo[@"info"] isEqualToString:@"shadown"]) {
		[LoadMaskHelper showMaskWithType:HomePage onView:self.view delay:0.01];
	}
	
}

@end
